import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TaskVO, TaskForm, TaskQuery } from '@/api/biz/task/types';

/**
 * 查询任务管理列表
 * @param query
 * @returns {*}
 */

export const listTask = (query?: TaskQuery): AxiosPromise<TaskVO[]> => {
  return request({
    url: '/biz/task/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询任务管理详细
 * @param tsakId
 */
export const getTask = (tsakId: string | number): AxiosPromise<TaskVO> => {
  return request({
    url: '/biz/task/' + tsakId,
    method: 'get'
  });
};

/**
 * 新增任务管理
 * @param data
 */
export const addTask = (data: TaskForm) => {
  return request({
    url: '/biz/task',
    method: 'post',
    data: data
  });
};

/**
 * 修改任务管理
 * @param data
 */
export const updateTask = (data: TaskForm) => {
  return request({
    url: '/biz/task',
    method: 'put',
    data: data
  });
};

/**
 * 删除任务管理
 * @param tsakId
 */
export const delTask = (tsakId: string | number | Array<string | number>) => {
  return request({
    url: '/biz/task/' + tsakId,
    method: 'delete'
  });
};
